//系统本地数据
var sysLocalSettings = {
	autoLogin : false,
	remPwd : false,
	isLogin : false,
	isReviewRight : false,
	isShopUser : false,
	roleId : -1,
	shopid : 0,
	LoginUser: {
		id:0,
		username : "",
		pwd : "",
		token : ""
	},
	param:{
		shopid:0,
		shopname:""
	},
	checkcodekey:'n3cua5shwe',
	version : 1.027
};

/**
 * 初始化应用本地配置
 **/
initSettings = function() {
	setSettings(sysLocalSettings);
	syslog("initSettings" + JSON.stringify(sysLocalSettings));
};

/**
 * 设置应用本地配置
 **/
setSettings = function(settings) {
	settings = settings || {};
	sysLocalSettings = settings;
	localStorage.setItem('$settings', JSON.stringify(settings));
	syslog("setSettings" + JSON.stringify(settings));
}

/**
 * 获取应用本地配置
 **/
getSettings = function() {
	var settingsText = localStorage.getItem('$settings') || "{}";
	syslog("getSettings" + settingsText);
	var settings = JSON.parse(settingsText);
	if(settingsText == "{}" || sysLocalSettings.version > settings.version){
		initSettings();
		return sysLocalSettings;
	}
	return JSON.parse(settingsText);
}


